'use strict'
const os = require('os');
module.exports = appInfo => {
  const config = (exports = {})

  config.logger = {
    appLogName: `${appInfo.name}-web.log`,
    dir: './logs/',
  }

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_{{keys}}'

  config.tokenFailureTime = '30 days'

  config.WX_APPID = 'wx40186d9776e1bf89'

  config.WX_SECRET = '256ae9af79f346b3f774e19ea344aa46'

  config.jwt = {
    secret: 'defaultSecret',
  }

  config.middleware = ['errorHandler']

  config.sequelize = {
    dialect: 'mysql',
    host: 'gz-cynosdbmysql-grp-0vwlm22l.sql.tencentcdb.com',
    port: 25317,
    database: 'trackerdb',
    username: 'tracker',
    password: 'tracker_123456',
    timezone: '+08:00',
  }

  config.security = {
    csrf: {
      enable: false,
    },
  }

  config.cors = {
    origin: '*',
    allowMethods: 'GET, POST, PUT, DELETE',
  }

  config.cluster = {
    workers: os.cpus().length, // 根据 CPU 核心数设置 Worker 数量
  }

  return config
}
